/**
 * Created by wentian on 2016-08-16.
 */
define(['text!view/index.html','jquery','template'],function (tpl,$,template) {

    appView.html(tpl);

    var controller = function (name,bbb) {

        console.log(name);
        console.log(bbb);

        var data = {
            title:'问天',
            list: ['摄影', '电影', '民谣', '旅行', '吉他']
        };

        //var render = template.compile(tpl);
        //var html = render(data);

        var html = template('block2', data);
        $("#main").html(html);


        $('button').on('click', function clickHandler() {
            alert('hello');
        });

        this.onRouteChange = function () {
            console.log('change');      //可以做一些销毁工作，例如取消事件绑定
            $('button').off('click');   //解除所有click事件监听
        };
    };

    return controller;
});